<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="提现人ID" prop="withdrawUserId">
        <el-input
          v-model="queryParams.withdrawUserId"
          placeholder="请输入提现人ID"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="manageList">
      <el-table-column label="序号" type="index" width="50" align="center">
        <template slot-scope="scope">
          <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
        </template>
      </el-table-column>
      <el-table-column label="提现金额(分)" align="center" prop="withdrawMoney" />
      <el-table-column label="提现时间" align="center" prop="withdrawTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.withdrawTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="提现人ID" align="center" prop="withdrawUserId" />
      <el-table-column label="提现人昵称" align="center" prop="withdrawUserName" />
      <el-table-column label="所属APP" align="center" prop="appName" />
      <el-table-column label="提现前账户" align="center" prop="withdrawBeforeMoney" />
      <el-table-column label="提现后账户" align="center" prop="withdrawAfterMoney" />
      <el-table-column label="提现状态" align="center" prop="withdrawStatus">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.withdraw_status" :value="scope.row.withdrawStatus"/>
        </template>
      </el-table-column>
<!--      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-s-check"
            @click="handleDelete(scope.row)"
            :disabled="scope.row.withdrawStatus !='1'"
          >审核</el-button>
        </template>
      </el-table-column>-->
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </div>
</template>

<script>
import { listDlManage, delDlManage } from "@/api/withdraw/manage";

export default {
  // 返佣审核
  name: "ManageDltx",
  dicts: ['withdraw_status'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 提现管理表格数据
      manageList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        withdrawUserId: null,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询提现管理列表 */
    getList() {
      this.loading = true;
      listDlManage(this.queryParams).then(response => {
        this.manageList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认审核通过编号为"' + ids + '"的数据项？').then(function() {
        return delDlManage(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("审核通过");
      }).catch(() => {});
    },
  }
};
</script>
